<?php
/**
 *      [迷你云] (C)2009-2012 南京恒为网络科技.
 *   软件仅供研究与学习使用，如需商用，请访问www.miniyun.cn获得授权
 * 
 */
?>
<div class="top-handle">
    <div class="con" id="js_page_op_menu">

            <a href="javascript:;" class="button btn-icon" menu="upload"><i class="icon ico-upload"></i>上传文件</a> 
            <a href="javascript:;" class="button btn-gray btn-icon" menu="adddir"><i class="icon ico-creat"></i>新建文件夹</a>
            <div class="btn-wrap" id="js_menu_btn_warp">
<!--                <a href="javascript:;" class="btn btn-disabled" menu="shareto">分享</a>-->
                <a href="javascript:;" class="btn btn-disabled" menu="download">下载</a>
                <a href="javascript:;" class="btn btn-opt btn-disabled" menu="more">更多操作<i class="arrow"></i></a>
            </div>
            <script type="text/javascript">
                $(document).ready(function(){
                    var arr = {"download": 1, "view_music":1};
                    if(document.all){
                        arr = {"download": 1, "view_doc":1, "add_music":1};
                    }
                    var box = $("#js_menu_btn_warp");

                    var list = [];
                    for(var k in arr){
                        if(arr[k]){
                            list.push(box.find("[menu='"+k+"']"));
                        }
                    }
                    var hideTopMenuBtn = function(){
                        var w = $(document).width();
                        if(w < 900){
                            for(var i = 0, len = list.length; i < len; i++){
                                list[i].hide();
                            }
                        }
                        else{
                            for(var i = 0, len = list.length; i < len; i++){
                                list[i].show();
                            }
                        }
                    }
                    hideTopMenuBtn();
                    $(window).bind("resize", function(){hideTopMenuBtn();});
                })
            </script>
                
        
        
        <div class="search-box">
            <form id="js_search_file_form">
            <label for="js_search_input">搜索文件</label>
            <input type="text" class="text" name="search_value" autocomplete="off" value="" id="js_search_input">
            <button type="submit"><i>搜索</i></button>

            </form>
            <script type="text/javascript" src="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/js/search_file.js?v=<?php echo(Yii::app()->params['app']['version'])?>" charset="utf-8"></script>
        </div>
        
                        <div class="btn-wrap" style="float:right;">
            <a href="javascript:;" class="btn focus" onclick="parent.window.PageCTL.ChangeMode('list'); return false;"><b class="list-type type-list">列表</b></a>
            <a href="javascript:;" class="btn " onclick="parent.window.PageCTL.ChangeMode('view'); return false;"><b class="list-type type-thumb">缩略图</b></a>
            <a href="javascript:;" class="btn  " onclick="parent.window.PageCTL.ChangeMode('view_large'); return false;"><b class="list-type type-large">大缩略图</b></a>

        </div>
            </div>
</div>
<script type="text/javascript">
    try{
        if(parent){
            parent.window.PageCTL.MarkURL(window.location.href);
        }
    }catch(e){}
</script>        <div class="page-main">
            <div class="col-main" id="js_cantain_box">
                <div class="path-box" rel="page_local"></div>
                <div class="list-container" id="js_data_list_outer">
                
                 <?php if ($count > 0){ ?>
                        <div style="min-height:100%;_height:100%;cursor:default;" id="js_data_list">
                                 <dl class="file-list list-star" rel="list" id="js_data_list_inner">
                                <dt>
                                <ul>
                                    <li class="file-check"><input type="checkbox" check="all" id="js_datalist_check_all"><label for="js_datalist_check_all">全选</label></li>
                                    <li class="file-name" order="file_name"><a href="javascript:;">文件名</a></li>
                                    <li class="file-time" order="user_ptime"><a href="javascript:;">上传时间</a></li>
                                    <li class="file-size" order="file_size"><a href="javascript:;">大小</a></li>

                                </ul>
                                </dt>

                                <?php foreach($list as $file){?>

                                <?php if($file['file_type'] == 0){
                                    $isExist = @Thumbnail::$_support_types[strtolower($file['ext'])];
                                    $imgUrl = "";
                                    if ($isExist) {
                                      $imgUrl = htmlspecialchars("img_url='".Yii::app()->params['app']['host']."/index.php?r=thumbnail/index&size=normal&tid=".$file['id']."&ver=".$file['version_id']."'");
                                    }
                                     ?>
                                 <dd rel="item" file_type="1" file_size="<?php echo $file['byte']?>" user_ptime="<?php echo $file['file_update_time']?>" is_share="0" pick_expire="" file_id="<?php echo $file['id']?>" file_status="1" area_id="1" p_id="<?php echo $file['parent_file_id']?>" ico="<?php echo $file['ext']?>" pick_code="<?php echo $file['id']?>" has_pass="0" <?php echo $imgUrl;?> file_gps="<?php echo $file['gps']?>">
                                    <textarea style="display:none;" field="desc"></textarea>
                                    <textarea style="display:none;" field="ext3"></textarea>
                                    <ul>
                                        <li class="file-check">
                                            <input type="checkbox" value="<?php echo $file['id']?>"/>
                                            <?php if($file['is_star']==1){ ?>
                                                <a class="star-favor star-collect" title="加入我的最爱" is_star="1" menu="star" href="javascript:;">最爱</a>
                                            <?php }else{ ?>
                                                <a class="star-favor " title=" 加入我的最爱" menu="star" href="javascript:;">最爱</a>
                                            <?php } ?>
                                            <?php if(!empty($file['gps'])){ ?>
                                                <a class="location location-collect" title="地图显示" is_exif="1" tpl="list_pg" file_name=<?php echo $file['file_name']?> menu="location" href="javascript:;">相册地点</a>
                                            <?php } ?>
                                        </li>
                                        <li class="file-name">
                                            <i class="file-type tp-<?php echo $file['ext']?>"></i>
                                            <span class="name-con">
                                                <a href="javascript:;" target="_blank" title="<?php echo $file['file_name']?>" rel="file" field="file_name"><?php echo $file['file_name']?></a>
                                                
                                            </span>
                                        </li>
                                        <li class="file-time"><?php echo $file['file_update_time']?></li>

                                        <li class="file-size"><?php echo $file['file_size']?></li>
                                       </ul>
                                </dd>
                                <?php }else{ ?>
                                <dd rel="item" file_type="0" is_share="0" area_id="1" p_id="<?php echo $file['parent_file_id']?>" cate_id="<?php echo $file['id']?>" cate_name="<?php echo $file['file_name']?>" pick_code="<?php echo $file['id']?>" has_pass="0" file_pwd="">
                                    <ul>
                                        <li class="file-check">
                                            <input type="checkbox" value="<?php echo $file['id']?>" />
                                            <textarea style="display:none;" field="ext3"></textarea>
                                        </li>

                                        <li class="file-name">
                                            <i class="file-type tp-folder"></i>
                                            <span class="name-con">
                                                <a href="javascript:;" cate="1" btn="goto_dir" aid="1" cid="<?php echo $file['id']?>" title="<?php echo $file['file_name']?>" rel="view_folder"><?php echo $file['file_name']?></a>                                            </span></li>
                                        <li class="file-time">&nbsp;</li>
                                        <li class="file-size">&nbsp;</li>
                                    </ul>
                                </dd>
                                <?php }}?>
                            </dl>
                    </div>
                <?php }else{ ?>
                    <div class="no-file">
                    <div class="page-info">
                    <h3><i class="i-hint ico-inf"></i>当前目录没有文件</h3>
                        <p>用户在"我的文件"中可以永久存储各种文件！</p>
                        <p>用户可以进行查看属性、修改名称、删除等各种管理文件的操作！</p>
                        </div>
                    </div>
                 <?php }?>
             
                </div>
                    <div class="pages"><div class="con">
                    <?php if ($pageSize > 1){ ?>
                    <?php if ($currentPage ==1){ ?>
                        <span class='btn btn-prev'>上一页</span>
                    <?php }else{?>
                        <a href='<?php echo(Yii::app()->params['app']['host'])?>/index.php?r=list/index&ct=file&ac=userfile&limit=<?php echo $limit?>&tpl=list_pg&aid=1&cid=<?php echo $cid?>&s=<?php echo ($currentPage-2)*$limit?>' class='btn btn-prev'>上一页</a>
                    <?php }?>
                     <?php   for ($i=1; $i <= $pageSize; $i++){
                            $css = "";
                            if ($i == $currentPage){
                                $css = "class='focus'";
                            }
                     ?>
                    <a href='<?php echo(Yii::app()->params['app']['host'])?>/index.php?r=list/index&ct=file&ac=userfile&limit=<?php echo $limit?>&tpl=list_pg&aid=1&cid=<?php echo $cid?>&s=<?php echo ($i-1)*$limit?>' <?php echo $css?>'><?php echo $i?></a> 
                    <?php } ?>
                    <?php if ($pageSize == $currentPage) {?>
                        <span class="btn btn-next">下一页</span>
                    <?php }else{ ?>
                        <a href='<?php echo(Yii::app()->params['app']['host'])?>/index.php?r=list/index&ct=file&ac=userfile&limit=<?php echo $limit?>&tpl=list_pg&aid=1&cid=<?php echo $cid?>&s=<?php echo ($currentPage)*$limit?>' class='btn btn-next'>下一页</a>
                    <?php }} ?>
                    </div></div>
                    
             
                    
            </div>
            <div class="col-sub">
                <div id="js_right_side">
                </div>
                <div class="sub-space" id="js_space_box" style="display:none;"><i class="icon"></i><span rel="space_text"></span><span class="space-status"><i style="width:0;" rel="space_line"></i></span></div>
            </div>
        </div>

<?php
$navStr = "";
foreach($nav as $data){
    $fileName       = $data["fileName"];
    $id             = $data["id"];
    $parent_file_id = $data["parent_file_id"];
    $navStr = $navStr.",{\"name\":\"$fileName\",\"aid\":1,\"cid\":\"$id\",\"pid\":$parent_file_id}";
}
?>


<script type="text/javascript">
    var IsTempLoad = true;
    var dataSource = {aid: 1, cid: <?php echo $cid;?>, order: '',is_asc: '0'};
    var NoRightSide = false;
    var LIST_CONFIG = {
        top_tip: eval('([{"name":"我的<?php echo(Yii::app()->params['app']['name'])?>","aid":1,"cid":"1_0","pid":0}<?php echo $navStr?>])')
    };
</script>
<!--加载谷歌地图api-->
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
